<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  

  <script>
      const inputDom = document.createElement('input')
      const buttonDom = document.createElement('button')
      // 设置 input 元素的属性
      inputDom.type = "text"
      inputDom.name = "username"
      inputDom.placeholder = "请输入"
      buttonDom.textContent = '查询'
      document.body.appendChild(inputDom)
      document.body.appendChild(buttonDom)

      buttonDom.addEventListener('click',function(e){
        console.dir(inputDom)
          const val = inputDom.value
          
          const text = document.createElement('text')
          text.textContent = val
          document.body.appendChild(text)
          history.pushState({value:val},null,'#'+val)
      })

      window.addEventListener('popstate',function(e){

          console.log(e)
      })
  </script>
</body>
</html>